import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2023-04-26
 * Time: 15:10
 */
public class BankAccount {
    public static void main(String[] args) {
        HashMap<String,Integer> mapAccount = new HashMap<>();
        mapAccount.put("王志芳",5000);
        mapAccount.put("于光",8000);
        mapAccount.put("贾燕青",10000);
        mapAccount.put("韩云庆",20000);
        mapAccount.put("闫智胜",30000);
        Scanner scan = new Scanner(System.in);
        System.out.println("=====选择存取款====");
        System.out.println("1.存款  2.取款");
        System.out.println("请选择：");
        int select = scan.nextInt();
        if(select == 1){
            System.out.println("请输入用户名和存款金额");
        }else if(select == 2){
            System.out.println("请输入账户名和取款金额");
        }
        String access  = scan.next();
        String[] sAccess = access.split(",");
        if(mapAccount.containsKey(sAccess[0])){
            Integer money = mapAccount.get(sAccess[0]);
            if(select == 1){
                money = money + Integer.parseInt(sAccess[1]);
            }else if(select == 2){
                money = money - Integer.parseInt(sAccess[1]);
            }
            System.out.println(sAccess[0]+"账户余额为"+money+"元");
        }else {
            System.out.println("该账户不存在");
        }
        scan.close();
    }
}
